class Role extends egret.Bitmap{
    private _id:number;
    private _dis:boolean;
    private p1:egret.Point;
    private p2:egret.Point;
    private p3:egret.Point;
    public constructor(id:number,dis:boolean,p1:egret.Point,p2:egret.Point,p3:egret.Point){
        super(RES.getRes("apple_png"));
        this._id=id;
        this._dis=dis;
        this.p1=p1;
        this.p2=p2;
        this.p3=p3;
        this.init();
    }
    public run():void{
        egret.Tween.get(this).to({factor: 1}, 500);
    }
    public get factor():number {
        return 0;
    }
    public set factor(value:number) {
        this.x = (1 - value) * (1 - value) * this.p1.x + 2 * value * (1 - value) * this.p2.x + value * value * this.p3.x;
        this.y = (1 - value) * (1 - value) * this.p1.y + 2 * value * (1 - value) * this.p2.y  + value * value * this.p3.y ;
        this.rotation=(this._dis?1:-1)*360*value;
    }
    private init():void{
        this.anchorX= this.anchorY=0.5;
    }
}
